
(function(util) {

	/**
 * The names of the fields that are defined on Object.prototype.
 * @type {Array.<string>}
 * @private
 */
var PROTOTYPE_FIELDS_ = [
  'constructor',
  'hasOwnProperty',
  'isPrototypeOf',
  'propertyIsEnumerable',
  'toLocaleString',
  'toString',
  'valueOf'
];

/**
 * Extends an object with another object.
 * This operates 'in-place'; it does not create a new Object.
 *
 * Example:
 * var o = {};
 * extend(o, {a: 0, b: 1});
 * o; // {a: 0, b: 1}
 * extend(o, {c: 2});
 * o; // {a: 0, b: 1, c: 2}
 *
 * @param {Object} target  The object to modify.
 * @param {Object} var_args The objects from which values will be copied.
 */
var extend = function(target, var_args) {
  var key, source;
  for (var i = 1; i < arguments.length; i++) {
    source = arguments[i];
    for (key in source) {
      target[key] = source[key];
    }

    // For IE the for-in-loop does not contain any properties that are not
    // enumerable on the prototype object (for example isPrototypeOf from
    // Object.prototype) and it will also not include 'replace' on objects that
    // extend String and change 'replace' (not that it is common for anyone to
    // extend anything except Object).

    for (var j = 0; j < PROTOTYPE_FIELDS_.length; j++) {
      key = PROTOTYPE_FIELDS_[j];
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }
};

	var wordCap = function(word) {
	  return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase()
	};

	util = util || {};
	util.bind = function(fn) {
	  var __method = fn;
	  var args = Array.prototype.slice.call(arguments, 1);
	  var object = args.shift();
	  return function() {
	    return __method.apply(object, args.concat(Array.prototype.slice.call(arguments)));
	  }
	};
	util.format = function(f) {
	  var args = arguments;
	  var len = args.length;
	  var i = 1;
	  var str = String(f).replace(/%[sdj%]/g, function(x) {
	    if(i >= len) return x;
	    switch(x) {
	      case '%s':
	        return String(args[i++]);
	      case '%d':
	        return Number(args[i++]);
	      case '%j':
	        return JSON.stringify(args[i++]);
	      case '%%':
	        return '%';
	      default:
	        return x;
	    }
	  });
	  return str;
	};
	util.extend  = extend;
	util.wordCap = wordCap;
	window.util  = util;
})(window.util);


;(function(window) {

var Store = window.Store = function(prefix) {
	this._prefix = prefix || '';
};
Store.prototype.get = function(k, o) {
	var that = this;
	var obj = JSON.parse(window.localStorage.getItem(that._prefix + (o||k)));
	return o?(obj?obj[k]:null):obj;
};
Store.prototype.set = function(k, v, o) {
	var that = this;
	window.localStorage.setItem(that._prefix + (o||k), JSON.stringify(o?(function() {
		var i = that.get(o)||{};
		i[k] = v;
		return i;
	})():v));
};
Store.prototype.remove = function(k) {
	var that = this;
	window.localStorage.removeItem(that._prefix + k);
};
Store.prototype.clear = function() {
	window.localStorage.clear();
};

})(window);